package com.demo.springboot;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/***
 * Spring4.3 新特性
 * 注意： 1.构造函数只能有一个，如果有多个的话，就必须有无参数的构造函数，就会默认调用无参数的构造函数，就会报空指针的异常
 *        2.构造函数的参数必须都在Spring容器中有
 */
@Component
public class Bank {

    private ApplicationContext applicationContext;
    private User user;

    public Bank(ApplicationContext applicationContext, User user) {
        applicationContext.getApplicationName();
        this.applicationContext = applicationContext;
        this.user = user;
    }

    public void show() {
        System.out.println("Bank Show  -----: " + applicationContext.getClass());
    }
}
